<template>
    <div>
        <detailBanner :sightName='sightName' :bannerImg='bannerImg' :gallaryImgs='gallaryImgs'></detailBanner>
        <detailHeader></detailHeader>
        <!-- 测试 -->
        <div class="content">
            <detailList :list='list'></detailList>
        </div>
    </div>
</template>
<script>
    import detailBanner from './components/Banner.vue'
    import detailHeader from './components/Header.vue'
    import detailList from './components/List.vue'
    import axios from 'axios'
    export default {
        name: 'detail',
        components: {
            detailBanner,
            detailHeader,
            detailList
        },
        data() {
            return {
                sightName: '',
                bannerImg: '',
                gallaryImgs: [],
                list: []
            }
        },
        methods: {
            getDatilInfo() {
                axios.get('/api/detail.json', {
                    params: {
                        // 获取动态路由的id
                        id: this.$route.params.id
                    }
                }).then(this.handleGetDataSucc)
            },
            handleGetDataSucc(res) {
                res = res.data;
                // if (res.ret && res.data) {
                    const data = res.data;
                    this.sightName = data.sightName;
                    this.bannerImg = data.bannerImg;
                    this.gallaryImgs = data.gallaryImgs;
                    this.list = data.categoryList;
                // }
            }
        },
        mounted() {
            this.getDatilInfo();
        }
    }
</script>
<style lang="less" scoped>
    .content {
        height: 50rem;
    }
</style>


